<!doctype html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>美女活动首页</title>

    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=640, user-scalable=no">

    <link href="${resources}/plugins/swiper/swiper-3.3.1.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="${resources}/css/common.css">
    <link rel="stylesheet" href="${resources}/css/activityIndex2.css">
</head>
<body>
<div id="container">
    <div class="header">
        <a href="${path}/manage/vote/one" class="back"><img src="${resources}/vote/4_1.png">返回</a>
        <h3>有奖票选最美员工</h3>
    </div>

    <div class="searchArea">
        <img src="${resources}/vote/4_3.png">
        <input id="empNO" type="text" placeholder="请输入员工号">
        <button id="getEmp">搜索</button>
    </div>

    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img src="${resources}/vote/4_4.png"></div>
            <div class="swiper-slide"><img src="${resources}/vote/4_5.png"></div>
            <div class="swiper-slide"><img src="${resources}/vote/4_6.png"></div>
        </div>
        <div class="swiper-pagination"></div>
    </div>

    <div class="content">
        <div class="navBar">
            <ul>
                <li><a href="${path}/manage/vote/one"><img src="${resources}/vote/4_7_17.jpg"></a></li>
                <li><a href="#"><img src="${resources}/vote/4_7_19.jpg"></a></li>
                <li><a href="${path}/manage/vote/empRanking"><img src="${resources}/vote/4_7_21.jpg"></a></li>
                <li><a href="#"><img src="${resources}/vote/4_7_23.png"></a></li>
            </ul>
        </div>

        <div class="img1"><img src="${resources}/vote/4_8.png"></div>

        <div id="list">
            <div class="row">
                <a href="#">
                    <div class="imgBox"><img src="${resources}/vote/1_5.jpg"></div>
                    <div class="info">
                        <h3>张三三</h3>
                        <span>排名:&nbsp; 12</span>
                        <span>部门:&nbsp; 评定</span>
                    </div>
                </a>
                <div class="btn">
                    <button>为她投票</button>
                </div>
            </div>
        </div>
    </div>

    <div class="bottom"><img src="${resources}/vote/4_15.png"></div>
</div>

<script src="${resources}/scripts/jquery-2.2.2.min.js"></script>
<script src="${resources}/plugins/swiper/swiper-3.3.1.jquery.min.js"></script>
<script src="${resources}/scripts/jqPaginator.min.js"></script>
<script>
    var mySwiper = new Swiper(".swiper-container", {
        loop: true,
        pagination: '.swiper-pagination',
        autoplay: 3000
    });
    var selData = ({
    	pageNumber : 1
    })
    function paging(cfg) {
        var paginator = $("#list");

        paginator.jqPaginator({
            totalCounts: 500,//总条目数
            pageSize: 4,//每一页显示的条目数
            visiblePages: 5,//分多少页
            currentPage: 1,//当前页数
            first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
            prev: '<li class="prev"><a href="javascript:void(0);">《 上一页<\/a><\/li>',
            next: '<li class="next"><a href="javascript:void(0);">下一页》 <\/a><\/li>',
            last: '<li class="last"><a href="javascript:void(0);">末页<\/a><\/li>',
            page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
            wrapper: '<ul class="pageBtn"></ul>',
        	//页面加载和点击页码时请求数据
			onPageChange: function (num) {
				selData.pageNumber= num;
				$.get(cfg.url, "", function (res) {
				 //重新配置分页的总条目数
				 var count = -(res.msg) * (-1);
				 paginator.jqPaginator('option', {
					 totalCounts: count
				 });
				 var html ='';
			  	 for (var i = 0; i < res.result.length; i++) {
			  		 var emp = res.result[i];
                     html += '<div class="row"><a href="#"><div class="imgBox"><img src="'+emp.picurl+'"></div><div class="info">';
                     html += '<h3>'+emp.name+'</h3><span>排名:&nbsp;'+(4*(num-1)+(i+1))+'</span><span>部门:&nbsp;'+emp.cooprt.name+'</span></div></a><div class="btn">';
                     html += '<button  onclick="vote('+emp.id+')">为她投票</button></div></div>';
                 }
				 $("#list").append(html);
				 });
			}
       });
    }
    paging({url: "${path}/manage/vote/empListData/${cooperId}"});
</script>
<script src="${resources}/scripts/common.js"></script>
<script>
function vote(id){
	window.location.href="${path}/manage/vote/empInfo/"+id;
}
   $("#getEmp").on("click",function(){
	   var empNo =$("#empNO").val();
	   $.ajax({
           type: "GET",
           url: "${path}/manage/vote/empInfo",
           data:{
        	   empNo:empNo  
           },
           dataType: "json",
           success: function(data){
        	   			if(data.code==100){
						 	window.location.href="${path}/manage/vote/empInfo/"+data.result.id;
        	   			}else{
	        	   			 common.alert({
	        	   			  title:'系统提示',
	        	   			  content:'没有找到该员工'
	        	   		 	 });
        	   			}
                    }
            });
   });
</script>
</body>
</html>